#!/bin/bash

#功能: IFS内部字段分隔符
#说明: 默认是空格/制表符/换行符

oldIFS=$IFS

#IFS是空格/制表符/换行符
str="this is a test"
for item in $str
do
    echo $item
done

#修改IFS为,
echo "-----修改后------"
IFS=","
for item in $str
do
    echo $item
done

str="this,is,a, test"
echo "-----修改str后------"
for item in $str
do
    echo $item
done

IFS=$oldIFS
